package com.kantboot.business.shop.web.i18n.controller;

import com.kantboot.business.shop.service.IBusShopGoodsTypeI18nService;
import com.kantboot.global.rest.result.CommonSuccessStateCodeAndMsg;
import com.kantboot.util.common.result.RestResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 商品类型国际化控制器
 */
@RestController
@RequestMapping(value = "/business-shop-web/shopGoodsTypeI18n")
public class BusShopTypeI18nController {

    @Resource
    private IBusShopGoodsTypeI18nService service;

    /**
     * 根据语言编码获取商品类型国际化信息
     * @param languageCode 语言编码
     * @return 商品类型国际化信息
     */
    @RequestMapping(value = "/getByLanguageCode")
    public RestResult<?> getByLanguageCode(
            @RequestParam("languageCode") String languageCode) {
        return RestResult.success(service.getByLanguageCode(languageCode), CommonSuccessStateCodeAndMsg.GET_SUCCESS);
    }

    /**
     * 根据商品类型ID获取商品类型国际化信息
     * @param goodsTypeId 商品类型ID
     * @return 商品类型国际化信息
     */
    @RequestMapping(value = "/getByGoodsTypeId")
    public RestResult<?> getByGoodsTypeId(
            @RequestParam("goodsTypeId") Long goodsTypeId) {
        return RestResult.success(service.getByGoodsTypeId(goodsTypeId), CommonSuccessStateCodeAndMsg.GET_SUCCESS);
    }

    /**
     * 获取所有
     */
    @RequestMapping(value = "/getAll")
    public RestResult<?> getAll() {
        return RestResult.success(service.getAll(), CommonSuccessStateCodeAndMsg.GET_SUCCESS);
    }

}
